package cn.xhjava.crm.workbench.controller.chat;

import cn.xhjava.crm.workbench.domain.DateDataMapVO;
import cn.xhjava.crm.workbench.domain.FunnelVO;
import cn.xhjava.crm.workbench.service.ContactsService;
import cn.xhjava.crm.workbench.service.CustomerService;
import cn.xhjava.crm.workbench.service.TranService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

@Controller
public class CustomerChartController {
    @Autowired
    private CustomerService customerService;
    @Autowired
    private ContactsService contactsService;

    @RequestMapping("/workbench/chart/customerAndContacts/index")
    public String customerAndContactsIndex() {
        //跳转页面
        return "workbench/chart/customerAndContacts/index";
    }

    @RequestMapping("/workbench/chart/customer/queryCountGroupByCreateTime")
    public @ResponseBody
    Object queryCustomerCountGroupByCreateTime() throws Exception {
        DateDataMapVO dateDataMapVO = customerService.queryCustomerCountGroupByCreateTime();
        return dateDataMapVO;
    }

    @RequestMapping("/workbench/chart/contacts/queryCountGroupByCreateTime")
    public @ResponseBody
    Object queryContactsCountGroupByCreateTime() throws Exception {
        DateDataMapVO dateDataMapVO = contactsService.queryContactsCountGroupByCreateTime();
        return dateDataMapVO;
    }

    @RequestMapping("/workbench/chart/contacts/queryCountGroupBySource")
    public @ResponseBody
    Object queryContactsCountGroupBySource() throws Exception {
        List<FunnelVO> res = contactsService.queryContactsCountGroupBySource();
        return res;
    }
}
